package com.company.cloud.ad.modules.api.fallback;

import com.company.cloud.ad.modules.api.response.AdResp;
import com.company.cloud.ad.modules.api.service.AdClientService;
import com.company.cloud.common.bean.BaseClientResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Log4j2
@Component
public class AdClientServiceFallbackFactory implements FallbackFactory<AdClientService>{

	@Override
	public AdClientService create(Throwable cause) {
		return new AdClientService() {

			@Override
			public BaseClientResult<List<AdResp>> getAdByPositionNo(String adPositionNo, String companyNo) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<AdResp> getAdById(Integer id) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<Map<Integer, AdResp>> getAdMapById(Set<Integer> ids) {
				return BaseClientResult.callbackError();
			}

		};
	}


}
